local function getupvaluetable(func, inname)
    local i = 1
    while true do
        local name, value = debug.getupvalue(func, i)
        if name == nil then
            return
        end
        
        if name == inname then
            return i,value
        end
        
        i=i+1
    end
end


local lua = _P.lua

local _, online_uids = getupvaluetable(lua.handler.get_online_user_play_info,'online_uids')
local _, uid_info_map = getupvaluetable(lua.handler.get_online_user_play_info,'uid_info_map')
local _, table_insert = getupvaluetable(lua.handler.get_online_user_play_info,'table_insert')
local _, skynet = getupvaluetable(lua.handler.get_online_user_play_info,'skynet')

local function get_online_user_play_info()
    local play_info_list = {}
    for uid,_ in pairs(online_uids) do
        local user_info = uid_info_map[uid]
        if user_info and not user_info.is_robot then
            local ok,coins = R().basesvr({key=uid}):call('.msg_handler','get_coins',uid)
            if not ok then
                errlog("get_online_user_play_info call fail")
            end

            local data = {uid=uid,name=user_info.name,coins = coins or 0,game_type=user_info.curr_game_type,table_type = user_info.curr_table_type}
            table_insert(play_info_list,data)
        end
    end
    return skynet.retpack(play_info_list)
end

lua.handler.get_online_user_play_info = get_online_user_play_info